package lumis.portal.user.serialization;

import java.util.EnumSet;

import lumis.portal.PortalException;
import lumis.portal.serialization.BaseSerializationContext;
import lumis.portal.serialization.DeserializationContext;
import lumis.portal.serialization.SerializationContext;
import lumis.portal.serialization.SerializationMessageConfigNode;
import lumis.portal.serialization.SerializationMessageConfigNode.RecursionStopPoints;
import lumis.portal.user.UserConfig;

/**
 * Manager Interface for User serialization 
 *
 * @version $Revision: 6239 $ $Date: 2007-03-26 15:50:32 -0300 (Mon, 26 Mar 2007) $
 * @since 4.0.7
 */
public interface IUserSerializationManager
{
	// DESERIALIZATION
	
	/**
	 * Deserialize a user.
	 * @param deserializationContext
	 * @param userSerializableConfig
	 * @throws PortalException
	 */
	public void deserialize(DeserializationContext deserializationContext, UserSerializableConfig userSerializableConfig) throws PortalException;

	// SERIALIZATION
	
	/**
	 * Serialize a user.
	 * @param serializationContext
	 * @param userConfig
	 * @return
	 * @throws PortalException
	 */
	public UserSerializableConfig serialize(SerializationContext serializationContext, UserConfig userConfig) throws PortalException;

	// GENERAL
	
	/**
	 * Set up a serialization context, defining settings such as class aliases, field aliases, transient fields, omitted collections etc.
	 * @param serializationContext
	 */
	public void setupSerializationContext(BaseSerializationContext serializationContext);

	/**
	 * Get a {@link SerializationMessageConfigNode} object containing fully recursive information about a user.
	 * @param baseSerializationContext
	 * @param userConfig
	 * @return
	 * @throws PortalException
	 */
	public SerializationMessageConfigNode getSerializationMessageConfigNode(BaseSerializationContext baseSerializationContext, UserConfig userConfig) throws PortalException;

	/**
	 * Get a {@link SerializationMessageConfigNode} object containing partially recursive information about a user.
	 * @param baseSerializationContext
	 * @param userConfig
	 * @param recursionStopPoints
	 * @return
	 * @throws PortalException
	 */
	public SerializationMessageConfigNode getSerializationMessageConfigNode(BaseSerializationContext baseSerializationContext, UserConfig userConfig, EnumSet<RecursionStopPoints> recursionStopPoints) throws PortalException;

}
